import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render,formattingMin } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '城市',
		align: "center",
		dataIndex: 'cityid_dictText'
	},
	{
		title: '添加时间',
		align: "center",
		dataIndex: 'createtime',
		customRender: ({ text }) => {
			return formattingMin(text)
		}
	},
	{
		title: '城市等级',
		align: "center",
		dataIndex: 'grade',
		customRender: (text) => {
			if (text.value == 1) {
				return '一级'
			} else {
				return '二级'
			}
		}
	},
	/*  {
	   title: '坐标',
	   align:"center",
	   dataIndex: 'gis'
	  }, */
	{
		title: '城市编码',
		align: "center",
		dataIndex: 'citycode',

	},

	/*  {
	   title: '其它信息',
	   align:"center",
	   dataIndex: 'extinfors'
	  }, */
];
//查询数据
export const searchFormSchema : FormSchema[] = [
];
//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '选择城市',
		field: 'cityid',
		component: 'JTreeSelect',
		componentProps: {
			dict: 'sys_category,name,id',
			pidField: 'pid',
			pidValue: '1230769196661510146',
			hasChildField: 'true',
		},
		/*  	show: ({ values }) => {
					return values.pid !== '0';
				},
				dynamicDisabled: ({ values }) => {
					return !!values.id;
				}, */
		dynamicDisabled: ({ values }) => {
			return values.isUpdate == true
		},
		required:true
	},
	{
		label: '城市等级',
		field: 'grade',
		component: 'JDictSelectTag',
		componentProps: {
			options: [
				{ label: '一级', value: "1" },
				{ label: '二级', value: "2" },
			]
		},
		required:true
		
	},
	{
		label: '坐标',
		field: 'gis',
		component: 'Input',
		slot: 'lotAndLat',
		required:true
	},
	{
		label: '城市编码',
		field: 'citycode',
		component: 'Input',
		required:true
	},
	/* 	{
			label: 'createtime',
			field: 'createtime',
			component: 'InputNumber',
		}, */
	/*  {
		label: '其它信息',
		field: 'extinfors',
		component: 'InputTextArea',
	  }, */
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
	{
		label: '',
		field: 'isUpdate',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}